<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- qtquick-navigator.qdoc -->
  <title>Managing Item Hierarchy | Qt Creator Manual</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="index.html">Qt Creator Manual</a></td><td >Managing Item Hierarchy</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="index.html">Qt Creator Manual 4.11.1</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
  <link rel="prev" href="quick-scalable-image.html" />
  <link rel="next" href="qtquick-properties.html" />
<p class="naviNextPrevious headerNavi">
<a class="prevPage" href="quick-scalable-image.html">Creating Scalable Buttons and Borders</a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="qtquick-properties.html">Specifying Item Properties</a>
</p><p/>
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#setting-the-stacking-order">Setting the Stacking Order</a></li>
<li class="level1"><a href="#switching-parent-items">Switching Parent Items</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Managing Item Hierarchy</h1>
<span class="subtitle"></span>
<!-- $$$qtquick-navigator.html-description -->
<div class="descr"> <a name="details"></a>
<p>The <b>Navigator</b> displays the items in the current QML file and their relationships. Items (1) are listed in a tree structure, below their parent (2).</p>
<p class="centerAlign"><img src="images/qmldesigner-navigator.png" alt="&quot;Navigator&quot;" /></p><p>You can select items in the <b>Navigator</b> to edit their properties in the <b>Properties</b> pane. Items can access the properties of their parent item. To select items on the canvas, right-click an item, and select another type in the context menu.</p>
<p>Typically, child items are located within the parent item on the canvas. However, they do not necessarily have to fit inside the parent item. For example, you might want to make a mouse area larger than the rectangle or image beneath it (1).</p>
<p class="centerAlign"><img src="images/qmldesigner-element-size.png" alt="&quot;Mouse area for a button&quot;" /></p><p>When you copy an item, all its child items are also copied. When you remove an item, the child items are also removed.</p>
<p>To show and hide items on the canvas when focusing on specific parts of the application, click <img src="images/eye_open.png" alt="" /> . To change the visibility of an item in the application code, select the <b>Visibility</b> check box in the <b>Properties</b> pane or select <b>Edit</b> &gt; <b>Visibility</b> in the context menu.</p>
<p>You can also set the <b>Opacity</b> field to 0 to hide items that you want to apply animation to.</p>
<p>As all properties, visibility and opacity are inherited from the parent item. To hide or show child items, edit the properties of the parent item.</p>
<p>To hide invisible items in the navigator, click <img src="images/filtericon.png" alt="" /> (<b>Filter Tree</b>) and select <b>Show only visible items</b>.</p>
<p>To reset item size, position, or anchors, select context menu commands. To change the source of an Image type, select <b>Change Source URL</b> in the context menu.</p>
<p>To view lists of files or projects, instead, select <b>File System</b>, <b>Open Documents</b>, or <b>Projects</b> in the menu. To view several types of content at a time, split the sidebars by clicking the <img src="images/splitbutton_horizontal.png" alt="" /> (<b>Split</b>) button.</p>
<a name="setting-the-stacking-order"></a>
<h2 id="setting-the-stacking-order">Setting the Stacking Order</h2>
<p>The <code>z</code> property of an <a href="http://doc.qt.io/qt-5/qml-qtquick-item.html">Item</a> determines its position in relation to its sibling items in the type hierarchy. By default, items with a higher stacking value are drawn on top of siblings with a lower stacking value. Items with the same stacking value are drawn in the order they are listed, from the last item up.</p>
<p>To move an item to the front or back of all its siblings, right-click it in the navigator or the <b>Form Editor</b> and select <b>Stack (z)</b> &gt; <b>To Front</b> or <b>To Back</b>. To raise or lower the stack value of an item, select <b>Raise</b> or <b>Lower</b>. To remove the <code>z</code> property, select <b>Reset z Property</b>.</p>
<p>You can also use a <b>StackLayout</b> item (Qt Quick Controls) to create a stacked view. For more information, see <a href="quick-components.html#using-layouts">Using Layouts</a>.</p>
<a name="switching-parent-items"></a>
<h2 id="switching-parent-items">Switching Parent Items</h2>
<p>When you drag and drop instances of QML types to the canvas, the new item is added as a child of the item beneath it. When you move items on the canvas, it is not possible to determine whether you want to adjust their position or attach them to a new parent item. Therefore, the parent item is not automatically changed. To change the parent of the item, press down the <b>Shift</b> key before you drag and drop the item into a new position. The topmost item under the cursor becomes the new parent of the item.</p>
<p>You can change the parent of an item also in the <b>Navigator</b>. Drag and drop the item to another position in the tree or use the arrow buttons (1) to move the item in the tree.</p>
<p class="centerAlign"><img src="images/qmldesigner-navigator-arrows.png" alt="&quot;Navigator arrow buttons&quot;" /></p></div>
<!-- @@@qtquick-navigator.html -->
<p class="naviNextPrevious footerNavi">
<a class="prevPage" href="quick-scalable-image.html">Creating Scalable Buttons and Borders</a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="qtquick-properties.html">Specifying Item Properties</a>
</p>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
